// TI File $Revision: /main/2 $
// Checkin $Date: April 29, 2005   11:08:40 $
//###########################################################################
//
// FILE:	DSP281x_Sci.c
//
// TITLE:	DSP281x SCI Initialization & Support Functions.
//
//###########################################################################
// $TI Release: DSP281x C/C++ Header Files V1.20 $
// $Release Date: July 27, 2009 $
//###########################################################################

#include "DSP281x_Device.h"     // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"   // DSP281x Examples Include File

//---------------------------------------------------------------------------
// InitSPI: 
//---------------------------------------------------------------------------
// This function initializes the SPI(s) to a known state.
//
void InitSci(void)
{
	// Initialize SCI-A:
	EALLOW;
	GpioMuxRegs.GPFMUX.bit.SCITXDA_GPIOF4=1;
	GpioMuxRegs.GPFMUX.bit.SCIRXDA_GPIOF5=1;

	EDIS;
	SciaRegs.SCICCR.all=0x0007;
	SciaRegs.SCICTL1.all=0x0003;

	SciaRegs.SCICTL2.all=0x0003;
	SciaRegs.SCICTL2.bit.TXINTENA=1;
	SciaRegs.SCICTL2.bit.RXBKINTENA=1;
	SciaRegs.SCIHBAUD = 0x0001;
	SciaRegs.SCILBAUD = 0x00E7;
	SciaRegs.SCIFFTX.all = 0xE040;
	SciaRegs.SCIFFRX.all = 0x6068;
	SciaRegs.SCIFFCT.all = 0x0;

	SciaRegs.SCICTL1.all=0x0023;
		//tbd...
 	

	// Initialize SCI-B:

	//tbd...
}	

void scia_xmit(char a)
{
	while(SciaRegs.SCIFFTX.bit.TXFFST!=0){}
	SciaRegs.SCITXBUF=a;
}


void scia_msg(char *msg){
	int i;
	i = 0;
	while(msg[i]!='\0')
	{
		scia_xmit(msg[i]);
		i++;

	}
}
	
//===========================================================================
// No more.
//===========================================================================
